import React, { Component } from 'react'
import PropTypes from 'prop-types'
import Item from '../item/Item'
import './List.css'
export default class List extends Component {
    //对接收的props进行：类型、必要性的限制
	static propTypes = {
		todos:PropTypes.array.isRequired,//必传的意思
		deltodo:PropTypes.func.isRequired,
		updatedoto:PropTypes.func.isRequired,
	}
    render() {
        const {todos,deltodo,updatedoto} =this.props
        return (
            
                <ul className='todo-main'>
                    {
                        todos.map(todo =>{
                            return <Item key={todo.id} {...todo} deltodo={deltodo} updatedoto={updatedoto}/>
                        })
                    }
                </ul>
            
        )
    }
}
